package com.hmall.search.pojo;

import lombok.*;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Builder
public class ItemDoc {

    // 分类
    private String category;
    // 品牌
    private String brand;
    // 价格
    private Integer price;
    // 销量
    private Integer sold;
    // id
    private Long id;
    // name
    private String name;
    // 评价数量
    private Integer commentCount;
    // 商品图片
    private String image;

    // 库存数量
    private Integer stock;
    // 规格
    private String spec;
    // 是否推广广告
    private Boolean isAD;
    // 商品状态
    private Integer status;
    // 创建时间
    private Object createTime;
    // 更新时间
    private Object updateTime;
    private List<String> suggestion;


	public ItemDoc(Item item) {
		this.category = item.getCategory();
		this.brand = item.getBrand();
		this.price = item.getPrice();
		this.sold = item.getSold();
		this.id = item.getId();
		this.name = item.getName();
		this.commentCount = item.getCommentCount();
		this.image = item.getImage();
		this.stock = item.getStock();
		this.spec = item.getSpec();
		this.isAD = item.getIsAD();
		this.status = item.getStatus();
		this.createTime = item.getCreateTime();
		this.updateTime = item.getUpdateTime();
		this.suggestion = Arrays.asList(this.brand, this.name,this.category);
	}
}
